import 'package:json_annotation/json_annotation.dart';
import 'package:body_measurement/models/order_item.dart';
import 'package:body_measurement/models/measuring_stats.dart';

part 'measuring_task.g.dart';

@JsonSerializable()
class MeasuringTask {
  MeasuringTask(
    this.id,
    this.userId,
    this.clientId,
    this.name,
    this.orderStatus,
    this.orderItems,
    this.remark,
    this.createTime,
    this.updateTime,
    this.userName,
    this.bodyItems,
    this.specialItems,
    this.enableDelete,
    this.enableEdit,
    this.measurers,
    this.stats,
  );

  int id;

  @JsonKey(name: 'user_id')
  int userId;

  @JsonKey(name: 'client_id')
  int clientId;

  String name;

  @JsonKey(name: 'order_status')
  int orderStatus;

  @JsonKey(name: 'order_items')
  List<OrderItem> orderItems;

  String? remark;

  @JsonKey(name: 'create_time')
  String createTime;

  @JsonKey(name: 'update_time')
  String updateTime;

  @JsonKey(name: 'user_name')
  String userName;

  @JsonKey(name: 'body_items')
  List<String> bodyItems;

  @JsonKey(name: 'special_items')
  List<String> specialItems;

  @JsonKey(name: 'enable_delete')
  int enableDelete;

  @JsonKey(name: 'enable_edit')
  int enableEdit;

  List<String> measurers;

  @JsonKey(name: 'stats')
  MeasuringStats stats;

  factory MeasuringTask.fromJson(Map<String, dynamic> json) => _$MeasuringTaskFromJson(json);

  Map<String, dynamic> toJson() => _$MeasuringTaskToJson(this);
}
